<?php include PATH_TPL."/admin/tpl.header.phtml"?>
<div class="main-container inner">
    <div class="main-content">
        <div class="container-fluid">
            <div class="row bt">
                <div class="col-lg-12 bg">
                    <ol class="breadcrumb">
                        <li class="active">
                        <i class="fa  fa-fw fa-reorder"></i>老人缴费
                        </li>
                    </ol>
                </div>
            </div>
            <div class="column">
            <div class="text-center"><h4><?=$tName?>老人缴费记录</h4></div>
            </div>
            <div class="panel-body text-center">
                <table class="table table-hover" id="table_list">
                    <thead>
                        <tr>
                            <td>编号</td>
                            <td>付费时间</td>
                            <td>付费金额</td>
                            <td>收款人</td>
                        </tr>
                    </thead>
                    <?foreach($tDatas as $tRow){?>
                    <tr>
                        <td><?=$tRow['id']?></td>
                        <td><?=date('Y-m-d',$tRow['created'])?></td>
                        <td><?=$tRow['fee']?></td>
                        <td><?=$tRow['handlers']?></td>
                    </tr>
                    <?}?>
                </table>
            <?=$tShow?>
            </div>
            </form>
        </div>
        <div class="subviews">
            <div class="subviews-container"></div>
        </div>
    </div>
    <!-- end: PAGE -->
</div>
<!-- end: MAIN CONTAINER -->
<script type="text/javascript" src="/plugins/datepicker/WdatePicker.js" charset="UTF-8"></script>
<script>
$('#search').click(function(){
    $('form').submit();
});
/*获取地址栏参数*/
function GetQuery(key){
	var search = location.search.slice(1);//得到get方式提交的查询字符串
	var arr = search.split("&");
	for(var i = 0; i < arr.length; i++){
		var ar = arr[i].split("=");
		if(ar[0] == key){
			return ar[1];
		}
	}
}
    var color="#eeeeee";
    $("#table_list tr:odd td").css("background-color",color);  //改变偶数行背景色
    /* 把背景色保存到属性中 */
    $("#table_list tr:odd").attr("bg",color);

    $('.issueBtn').each(function(){
        $(this).on('click',function(){
            var sid = $(this).parent().parent().find('td[name="sid"]').text();
            var basic_fee = $(this).parent().parent().find('td[name="basic_fee"]').text();
            var payment = $(this).parent().parent().find('td[name="payment"]').attr('data');
            var discount = $(this).parent().parent().find('td[name="discount"]').attr('data');
            var lasttime = $(this).parent().parent().find('td[name="lasttime"]').text();
            var fee = $(this).parent().parent().find('input[name="fee"]').val();
            $.post('/admin_elderlypayment',{ sid:sid,basic_fee:basic_fee,payment:payment,discount:discount,lasttime:lasttime,fee:fee },function(obj){
                if(obj.status == 0){
                    alert(obj.msg);return;
                }else{
                    alert(obj.msg);location.href="/admin_elderlypayment";
                }
            });
        });    
    });
</script>
<?php include PATH_TPL."/admin/tpl.footer.phtml"?>
